<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="../css/reset.css">
    <style>
        .container {
            /* 响应式版心 */
            max-width: 1200px;
            margin: auto;
        }

        header {
            background-color: #ff0;
        }

        header>div {
            display: flex;
            justify-content: space-between;
        }

        header h1 {
            line-height: 62px;
        }

        header ul {
            display: flex;
        }

        header ul li {
            margin: 20px;
        }


        @media screen and (min-width:320px) and (max-width:767px) {
            .icon {
                width: 30px;
                height: 30px;
                background-color: #f00;
                position: fixed;
                right: 0;
                top: 0;
                z-index: 1;
            }

            header ul {
                background-color: rgba(0, 0, 0, 0.5);
                flex-direction: column;
                position: fixed;
                width: 100%;
                color: #fff;
                text-align: center;

                height: 0;
                overflow: hidden;
                transition: 1s;
            }

            /* .icon:hover+ul {
                height: 300px;
            } */
            input:checked~ul {
                height: 300px;
            }
        }
    </style>
</head>

<body>

    <header>
        <div class="container">
            <h1>logo</h1>
            <div class="icon"></div>
            <input type="checkbox" hidden id="a">
            <label class="icon" for="a"></label>
            <ul>
                <li>home</li>
                <li>home</li>
                <li>home</li>
                <li>home</li>
                <li>home</li>
                <li>home</li>
                <li>home</li>
                <li>home</li>
            </ul>
        </div>
    </header>

</body>

</html>